package com.industrial.app.mapper;


import com.industrial.app.domain.BizIndustrialValueAddedByCity;
import com.industrial.app.domain.request.BizIndustrialValueAddedByCityRequest;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 分市工业增加值Mapper接口
 *
 * @author SangGuangCan
 * @date 2023-12-27
 */
public interface BizIndustrialValueAddedByCityMapper {

    /**
     * 查询分市工业增加值
     *
     * @param baseId 分市工业增加值主键
     * @return 分市工业增加值
     */
    public BizIndustrialValueAddedByCity selectBizIndustrialValueAddedByCityByBaseId(String baseId);

    /**
     * 查询分市工业增加值列表
     *
     * @param bizIndustrialValueAddedByCity 分市工业增加值
     * @return 分市工业增加值集合
     */
    public List<BizIndustrialValueAddedByCity> selectBizIndustrialValueAddedByCityList(BizIndustrialValueAddedByCity bizIndustrialValueAddedByCity);

    /**
     * 新增分市工业增加值
     *
     * @param bizIndustrialValueAddedByCity 分市工业增加值
     * @return 结果
     */
    public int insertBizIndustrialValueAddedByCity(BizIndustrialValueAddedByCity bizIndustrialValueAddedByCity);

    /**
     * 修改分市工业增加值
     *
     * @param bizIndustrialValueAddedByCity 分市工业增加值
     * @return 结果
     */
    public int updateBizIndustrialValueAddedByCity(BizIndustrialValueAddedByCity bizIndustrialValueAddedByCity);

    /**
     * 删除分市工业增加值
     *
     * @param baseId 分市工业增加值主键
     * @return 结果
     */
    public int deleteBizIndustrialValueAddedByCityByBaseId(String baseId);

    /**
     * 批量删除分市工业增加值
     *
     * @param baseIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBizIndustrialValueAddedByCityByBaseIds(String[] baseIds);

    /**
     * <p>
     * 查询数据库中数据的日期(year_month字段)并进行去重复操作<br/>
     * 主要用于的是APP端左上角的日期过滤
     * </p>
     *
     * @return 日期的集合
     */
    List<String> getUniqueDatesFromDatabase();

    /**
     * 查询当月的工业增加值
     * @param params
     * @return
     */
    List<BizIndustrialValueAddedByCity> getIndustrialValueAddedByCityList(@Param("p") BizIndustrialValueAddedByCityRequest params);

    @Select("select bivabc.`year_month` from biz_industrial_value_added_by_city as bivabc order by bivabc.`year_month` desc limit 1")
    String getLatestDateData();

    @Delete("delete from biz_industrial_value_added_by_city")
    void clearAllTableData();

    List<BizIndustrialValueAddedByCity> selectBizIndustrialValueAddedByCityAllData();

    void batchInsertBizIndustrialValueAddedByCity(@Param("list") List<BizIndustrialValueAddedByCity> list);

    List<BizIndustrialValueAddedByCity> selectBizIndustrialValueAddedByCityListNoParams();


}
